package group2projman;

import group2projman.User.Permission;

public abstract class BookTransaction extends Transaction implements DbWritable {
	int bookCopyId;
	
	public BookTransaction(int id, int pBookCopyId, Transaction.Type type) {
		super(id, type);		
		
		bookCopyId = pBookCopyId;
	}
	
	public int getId() {
		return id;
	}
	
	public String listAttributes() {		
		return super.listAttributes();
	}
	
	public boolean loadAttributes(String desc) {
		try {
			String[] split = desc.split("[;,]");	

			if (!split[3].equals("int:bookCopyId"))
				return true;	
			bookCopyId = Integer.parseInt(split[1]);
		
		return false;
		} catch (Exception e) {
		// Array index out of bounds or enum value not found
		return true;
		}
	}

}
